home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 9,300 to 9,399 / 9300.zip / AOLDLs / HTML & Web Tools (MAC) / PAGESPINNER_ V2.0.1 HTML Editor / PAGESP~1.sit / PageSpinner 2.0 / Includes / time.js next >
Text File  |  1997-05-28  |  2KB  |  74 lines

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!-- Beginning of JavaScript --------
  3.  
  4. // ********************************************************
  5.     time.js
  6.  
  7.     Time and date utilites in JavaScript.
  8.  
  9.     Included in  the PageSpinner distribution.
  10.     Copyright Optima System, 1997.
  11.  
  12.     Note:    Navigator 2.0 / 3.0 does often offset the time by
  13.             one hour. Not much seems to be possible to do fix this.
  14.  
  15.     This is an example of how to use PageSpinner Includes
  16.     files that contains JavaScript.
  17.  
  18.     We will not be held responsible for any unwanted 
  19.     effects due to the usage of this script or any derivative.
  20.     No warrantees for usability for any specific application 
  21.     are given or implied.
  22.  
  23.     You are free to use and modify these scripts
  24.     if the credit above is included.
  25. // ********************************************************
  26.  
  27. // getTime()
  28. // Returns: Text containing the time in the format HH:MM
  29.  
  30. function getTime()
  31. {       
  32.     var now = new Date();
  33.     var minutes = now.getMinutes();
  34.     var divider = ":";
  35.  
  36.     if (minutes<10)
  37.         divider = ":0";
  38.  
  39.     return( now.getHours() + divider + minutes );
  40. }
  41.  
  42. function showBetween (theText, altText, startAt, stopAt)
  43. {
  44.     var now = new Date();
  45.     var h = now.getHours();
  46.  
  47.     if (startAt <= stopAt)
  48.     {
  49.         if ( h >= startAt & h <= stopAt)
  50.             return(theText)
  51.         else
  52.             return (altText);
  53.     }
  54.     return ('** ERROR in JavaScript showBetween **');
  55. }
  56.  
  57. function showBetween (theText, altText, startAt, stopAt)
  58. {
  59.     var now = new Date();
  60.     var h = now.getHours();
  61.  
  62.     if (startAt <= stopAt)
  63.     {
  64.         if ( h >= startAt & h <= stopAt)
  65.             return(theText)
  66.         else
  67.             return (altText);
  68.     }
  69.     return ('** ERROR in JavaScript showBetween **');
  70. }
  71.  
  72. // -- End of JavaScript code -------------- -->
  73. </SCRIPT>
  74.